<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>点餐系统</title>
<meta name="Keywords" content="点餐系统">
<meta name="Description" content="点餐系统">
<link href="__CSS_ADMIN_PATH__/css.css" rel="stylesheet" type="text/css">
<link href="__PUBLIC_PATH__/fancybox/source/jquery.fancybox.css" rel="stylesheet" type="text/css">
<script src="__JS_PATH__/jquery-1.8.3.js" type="text/javascript"></script>
<script src="__PUBLIC_PATH__/fancybox/source/jquery.fancybox.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('.fancybox').fancybox();
	});
	
	function fancyboxClose(){	
		$.fancybox.close(); 
	}
</script>
</head>
<body>
<script language="javascript">
window.onload=function showtable(){
var tablename=document.getElementById("mytable");
var li=tablename.getElementsByTagName("tr");
var i=0;
for (i=0;i<=li.length-1;i++){
	li[i].style.backgroundColor="#fff";
	li[i].onmouseover=function(){
	this.style.backgroundColor="#f8f4f1";
}
	li[i].onmouseout=function(){
	this.style.backgroundColor="#fff"
}
}
}

/**
* 全选checkbox,注意：标识checkbox id固定为为check_box
* @author Tony
* @param string name 列表check名称,如 uid[]
*/
function selectall(name) {
	if ($("#check_box").attr("checked")=='checked') {
		$("input[name='"+name+"']").attr("checked","checked");
		$('.checkall').attr("checked"=='checked');
	} else {
		$("input[name='"+name+"']").removeAttr("checked");
		$('.checkall').removeAttr("checked");
	}
}
function confirm_delete(){
	if(confirm('确认删除吗？')) $('#myform').submit();
}
function confirmurl(url,str){
	if(confirm(str)){
	 location.href=url;
	}
}
//列表中修改单一数据的各种状态 added by Tony
function fetch_ajax(par,id){
	var imgUrl = '/Public/Admin/images/';
	var statusVal = $('#'+par+id).attr ('status');
	var value = $('#'+par+id).attr ('value');
	if(statusVal == 1){
	var imgName = 'no.gif';
	var status = 0;
	}else{
	var imgName = 'yes.gif';
	var status = 1;
	}
	if(statusVal!=1){
		if(confirm('你确定要改变桌位的状态吗？')){
			$.post('/index.php?g=Admin&m=Table&a=modifStatus',{'id':id,'value':value},function(re){
				if(re == 1){
					$('.tabStatus'+id).attr('status',0).attr('src',imgUrl+'no.gif');
					$('#'+par+id).attr ('status',status);
					$('#'+par+id).attr ('src',imgUrl+imgName);
				}
			});
		}
	}
} 
</script>

<script src="__JS_PATH__/jquery-1.8.3.js" type="text/javascript"></script>
<link href="__PUBLIC_PATH__/fancybox/source/jquery.fancybox.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC_PATH__/fancybox/source/jquery.fancybox.js" type="text/javascript"></script>
<link rel="stylesheet" href="__PUBLIC_PATH__/webedito/themes/default/default.css" />
<link rel="stylesheet" href="__PUBLIC_PATH__/webedito/plugins/code/prettify.css" />
<script charset="utf-8" src="__PUBLIC_PATH__/webedito/kindeditor.js"></script>
<script charset="utf-8" src="__PUBLIC_PATH__/webedito/lang/zh_CN.js"></script>
<script charset="utf-8" src="__PUBLIC_PATH__/webedito/plugins/code/prettify.js"></script>
<script>
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="content"]', {
			cssPath : '__PUBLIC_PATH__/webedito/plugins/code/prettify.css',
			uploadJson : '__PUBLIC_PATH__/webedito/php/upload_json.php',
			fileManagerJson : '__PUBLIC_PATH__/webedito/php/file_manager_json.php',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					K('form[name=content]')[0].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					K('form[name=content]')[0].submit();
				});
			}
		});
		prettyPrint();
	});
</script>
<script type="text/javascript">
    $(function(){
        $('#button').click(function(){
            if($('#menuName').val()==''){
                $('#menuName').focus();
                alert('菜的名不成为空');
                return false;
            }
            if($('#select').val()=='选择分类'){
                alert('请选择分类');
                return false;
            }
            if($('#menuPrice').val()==''){
                $('#menuPrice').focus();
                alert('菜的价格不成为空');
                return false;
            }

            if($('#menuCon').val()==''){
                $('#menuCon').focus();
                alert('请写菜的详细做法');
                return false;
            }
        });
    });
    $(document).ready(function() {
        $('.fancybox').fancybox();
	});
	
	function fancyboxClose(){	
		$.fancybox.close(); 
	}
	
	function getImg(imgUrl){
		if(imgUrl){
			$('#menuMa').val(imgUrl);
			$('#menuMaBtn').html('删除素材图片').removeClass().attr('href','javascript:delImg();');
			$('#menuMaShow').attr('src',imgUrl).show();
			$('#fileField').hide();
		}
		fancyboxClose();
	}
	function delImg(){
		$('#menuMa').val('');
		$('#menuMaBtn').html('选择素材图片').attr('href','/index.php/Admin/Menu/getMaterial').addClass('fancybox fancybox.iframe');
		$('#menuMaShow').attr('src','').hide();
		$('#fileField').show();
		$('#recover').show();
	}
	
	function recover(){
		var imgUrl = $('#recoverImgUrl').val();
		getImg(imgUrl);
		$('#recover').hide();
	}
</script>

<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="mart15">
  <tr>
    <td width="4"><img src="__IMG_ADMIN_PATH__/gk1.png" width="4" height="39" /></td>
    <td background="__IMG_ADMIN_PATH__/gk2.png"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="23" class="xtgk2"><img src="__IMG_ADMIN_PATH__/gk_1.png" width="16" height="16" /></td>
        <td class="xtgk1"><?php echo ($title); ?>菜品</td>
      </tr>
    </table></td>
    <td width="5"><img src="__IMG_ADMIN_PATH__/gk3.png" width="5" height="39" /></td>
  </tr>
</table>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#dca581">
  <tr>
    <td valign="top" bgcolor="#FFFFFF"><form action="<?php echo U(GROUP_NAME.'/Menu/editMenu');?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
		<input name="targetid" type="hidden" value="<?php echo ($m["id"]); ?>" />
      <table width="95%" id="mytable" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#efddd2" class="mart15 marb15 color333">
        <tr>
          <td align="right" bgcolor="#f5ede6">菜品名称</td>
          <td bgcolor="#FFFFFF"><h1>
              <input type="hidden" value="<?php echo ($m["id"]); ?>" name="id"/>
            <input type="text" name="name" id="menuName" class="input1" value="<?php echo ($m["name"]); ?>"/>
          </h1></td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F5EDE6">所属分类</td>
          <td bgcolor="#FFFFFF"><label for="select"></label>
            <select name="select" id="select">
              <option >选择分类</option>
                <?php if(is_array($list)): foreach($list as $key=>$v): ?><option <?php if($m['menutypeid'] == $v['id']): ?>selected<?php endif; ?> <?php if($v['parentid'] == 0): ?>disabled<?php endif; ?> value="<?php echo ($v["id"]); ?>"><b><?php echo ($v["html"]); echo ($v["name"]); ?></b></option><?php endforeach; endif; ?>
            </select></td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F5EDE6">价格</td>
          <td bgcolor="#FFFFFF"><input type="text" name="price" id="menuPrice" class="input1" value="<?php echo ($m["price"]); ?>" /></td>
        </tr>
          <tr>
              <td align="right" bgcolor="#F5EDE6">单位(例如：份，盘)</td>
              <td bgcolor="#FFFFFF"><input type="text" name="unit" id="textfield2" class="input1" value="<?php echo ($m["unit"]); ?>" /></td>
          </tr>
        <tr  height="230">
          <td align="right" bgcolor="#F5EDE6">上传图片</td>
          <td bgcolor="#FFFFFF"><label for="fileField"></label>
            <input  <?php if($m['img']): ?>style=" display:none;"<?php endif; ?> type="file" name="fileField" id="fileField" />
			<img id="menuMaShow" src="<?php echo ($m["img"]); ?>" <?php if(!$m['img'] && !$imgee): ?>style=" display:none;"<?php endif; ?> width="348" height="230"/>
			<input type="hidden" id="menuMa" name='picname' value="<?php echo ($m["img"]); ?>"/>
			<input type="hidden" id="recoverImgUrl"  value="<?php echo ($m["img"]); ?>"/>
			 <?php if($m['img']): ?><div style="margin:20px 0 0 20px;"><a id="recover" style="display:none" href="javascript:recover();" >还原</a><br/><a id="menuMaBtn" href="javascript:delImg();" >删除素材图片</a></div><?php else: ?> <div style="margin:20px 0 0 20px;">
			<a class="fancybox fancybox.iframe" id="menuMaBtn" href="/index.php/Admin/Menu/getMaterial" >选择素材图片</a></div><?php endif; ?> 
			</td>
        </tr>
		<tr>
          <td align="right" bgcolor="#F5EDE6">是否推荐</td>
          <td bgcolor="#FFFFFF">
		  	<input <?php if($m['recommend'] == 1): ?>checked<?php endif; ?> type="radio" name="recommend" value="1" />是
			<input <?php if($m['recommend'] == 0): ?>checked<?php endif; ?> type="radio" name="recommend" value="0"  />否
          </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#F5EDE6">详细介绍</td>
          <td bgcolor="#FFFFFF">
            <!--<textarea name="content" id="menuCon" class="input2"><?php echo ($m["content"]); ?></textarea>-->
			<textarea name="content" style="width:700px;height:200px;visibility:hidden;"><?php echo ($m["content"]); ?></textarea>
			</td>
        </tr>
        <tr>
          <td colspan="2" align="center" bgcolor="#FFFFFF" ><input type="submit" id="button" value="提交" class="input10" /></td>
        </tr>
      </table>
    </form></td>
        </tr>
      </table></td>
  </tr>
</table>
<STYLE type=text/css media=screen>
ul{ padding:0px; margin:0px;}
#downmsg_emessage {Z-INDEX: 100; RIGHT: 0px; BACKGROUND: url(__IMG_ADMIN_PATH__/down_msg_bg.gif) no-repeat left top; WIDTH: 225px; BOTTOM: 0px; POSITION: fixed; _position: absolute}
#donwmsg_head {MARGIN-TOP: 1px; DISPLAY: inline; FONT-SIZE: 12px; FLOAT: left; MARGIN-LEFT: 26px; COLOR: #ffffff}
#downmsgBar .close {MARGIN-TOP: 6px; DISPLAY: block; FLOAT: right; WIDTH: 11px; MARGIN-RIGHT: 5px; HEIGHT: 11px}
#downmsgBar {HEIGHT: 25px}
#donwmsg_content {OVERFLOW: hidden; HEIGHT: 162px}
#donwmsg_content UL {PADDING-RIGHT: 10px; height:68%; PADDING-LEFT: 10px; FONT-SIZE: 12px; LEFT: 6px; PADDING-BOTTOM: 0px; COLOR: #007cc1; LINE-HEIGHT: 180%; PADDING-TOP: 10px; TOP: 34px}
#donwmsg_content UL LI {BACKGROUND: url(__IMG_ADMIN_PATH__/down_msg_bg.gif) no-repeat -100px -245px; TEXT-INDENT: 13px}
#donwmsg_content UL LI A {COLOR: #007cc1}
#donwmsg_content UL .ll A {	FONT-WEIGHT: bold; COLOR: #a10000}
#donwmsg_content P {LEFT: 13px; POSITION: absolute; TOP: 157px}
#donwmsg_content .lb {PADDING-RIGHT: 14px; PADDING-LEFT: 14px; PADDING-BOTTOM: 14px; PADDING-TOP: 14px; TEXT-ALIGN: center}
#donwmsg_content .lb a{ font-size:13px;}
.msg-hidden-btn-2 {MARGIN-TOP: 6px; DISPLAY: block; BACKGROUND: url(__IMG_ADMIN_PATH__/down_msg_bg.gif) no-repeat left -250px; FLOAT: right; OVERFLOW: hidden; WIDTH: 11px; MARGIN-RIGHT: 5px; HEIGHT: 11px}
.msg-hidden-btn-1 {MARGIN-TOP: 6px; DISPLAY: block; BACKGROUND: url(__IMG_ADMIN_PATH__/down_msg_bg.gif) no-repeat -50px -250px; FLOAT: right; OVERFLOW: hidden; WIDTH: 11px; MARGIN-RIGHT: 5px; HEIGHT: 11px}
.sectionshover .trans {	BORDER-RIGHT: #ffc600 1px solid; BORDER-TOP: #ffc600 1px solid; BORDER-LEFT: #ffc600 1px solid; BORDER-BOTTOM: #ffc600 1px solid; HEIGHT: 24px; BACKGROUND-COLOR: #fff0b6
}
.sectionshover .trans LI {CLEAR: none; FLOAT: left; WIDTH: 200px}
.mm_gg LI {PADDING-LEFT: 15px; BACKGROUND: url(__IMG_ADMIN_PATH__/1254189745035.gif) no-repeat 4px 8px; LINE-HEIGHT: 20px}
.mm_gg LI A {COLOR: #8f3434}
.mm_gg LI A:hover {	COLOR: #8f3434}
.mm_gg LI:visited {COLOR: #8f3434}
</STYLE>
<script src="__JS_ADMIN_PATH__/jsc.js" type="text/javascript"></script>
<script src="__JS_ADMIN_PATH__/lightbox.js" type="text/javascript"></script>
<DIV id=downmsg_emessage style="DISPLAY: none ">
    <DIV id=downmsgBar>
        <DIV id=donwmsg_head>系统提示</DIV>
        <A class=close href="javascript:closeDiv()"></A>
        <A class=msg-hidden-btn-1 id=msg_hidden_btn href="javascript:showHideDiv()">&nbsp;</A>
    </DIV>
    <DIV id=donwmsg_content>
          <UL id="settleShow">
          </UL>
          <DIV class=lb>请赶往处理!</DIV>
    </DIV>
</DIV>
<script src="__JS_ADMIN_PATH__/down_msg.js" type="text/javascript"></script>
<SCRIPT type=text/javascript>
var downmsg = new downMsg("downmsg_emessage","donwmsg_content",{start_delay:2000, speed: 5, movepx:2,cookie:'downMsgcookie',expiresDay:1});
	window.setInterval(getSettle, 30000);//每隔30秒获取一次
//自动获取请求表数据	added by Tony
function getSettle(){
	$.post('/index.php?g=Admin&m=Login&a=getSettle','',function(html){
		var htmlLength = html.length;
		if(htmlLength){
			$('#settleShow').html(html);
			var msg_hidden_btn = $('#msg_hidden_btn').hasClass('msg-hidden-btn-1');
			if(msg_hidden_btn){
				downmsg.start();
				setTimeout('closeDiv()',10000);
			}
		}
	});
}
</SCRIPT>
</body></html>